package config

import (
	"encoding/json"
	"os"
	"errors"
)

func GetConfig(module string) (map[string]interface{},error) {

	var conf map[string]interface{}
	filePtr, err := os.Open("./config/"+module+".json")
	if err != nil {
		return conf,errors.New("配置文件未找到")
	}
	defer filePtr.Close()
	decoder := json.NewDecoder(filePtr)
	err = decoder.Decode(&conf)
	if err != nil {
		return conf,errors.New("配置文件解析失败")
	}
	return conf,nil

}

